package com.database.mapper;


import com.database.character.Praise;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PraiseMapper {

  //添加点赞
  @Insert("insert into praise(user_id, post_id) values (#{userId}, #{postId})")
  int addPraise(Praise praise);

  //取消点赞
  @Delete("delete from praise where post_id = #{postId}")
  int deletePraiseByPostId(Integer postId);

  //根据userId查询点赞
  @Select("select * from praise where user_id = #{userId}")
  List<Praise> getPraiseByUid(Integer userId);
}
